package com.jic.market.impl.rest.allocation;

import com.jic.market.common.enums.CostAllocationFlagEnum;
import com.jic.market.entity.AllocationModel;
import com.jic.market.entity.base.BaseActivity;
import com.jic.market.request.after.TellAddAllocationRequest;
import com.jic.market.request.rest.allocation.CollectionThemeInfoRequest;
import com.jic.market.response.rest.allocation.QueryAllocationAndThemeInfoResponse;
import com.jic.market.service.allocation.PromotionAddAllocationStrategy;
import com.jic.market.service.base.BaseActivityService;
import com.jic.market.service.rest.allocation.QueryPromotionForAllocationStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
 * @author xuyongliang
 * @version V1.0
 * @className PromotionAddAllocationStrategyCoupon
 * @description 优惠券活动信息查询策略
 * @date 2020/4/10
 */
@Slf4j
@Service("queryPromotionForAllocationCoupon")
public class QueryPromotionForAllocationStrategyCoupon implements QueryPromotionForAllocationStrategy {

    @Resource
    private BaseActivityService baseActivityService;

    @Override
    public QueryAllocationAndThemeInfoResponse collectionThemeInfo(CollectionThemeInfoRequest request) {
        log.info("--------进入优惠券活动信息查询策略request--{}-----",request);
        String promotionId =request.getPromotionCode();
        BaseActivity baseActivity = baseActivityService.queryActivityByPromotionId(promotionId);

        QueryAllocationAndThemeInfoResponse model =new QueryAllocationAndThemeInfoResponse();
        model.setStartTime(baseActivity.getStartTime());
        model.setEndTime(baseActivity.getEndTime());

        model.setProUserType(baseActivity.getProUserType());

//        model.setMailType(baseActivity.get);
        return model;
    }
}
